<template>
    <div>
        <el-form :model="form" label-width="80px">
            <el-form-item label="选择类型">
                <el-select v-model="form.id">
                    <el-option
                        v-for="item in parentOptions"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id"
                    >
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="名字">
                <el-input v-model="form.name"></el-input>
            </el-form-item>
            <el-form-item label="英文值">
                <el-input v-model="form.key"></el-input>
            </el-form-item>
            <el-form-item label="排序">
                <el-input v-model="form.order"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">立即创建</el-button>
                <el-button type="primary" @click="onCancel">取消</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
    import {computedPostSmDictionaryAdd} from "../.././css_js_img/computedSmDictionaryController"
    
    export default {
        data(){
            return {
                form : {
                    id: "",
                    name: "",
                    order: 1,   //默认排序
                },

            }
        },
        props: [
            "parentOptions",
        ],
        methods: {
            onSubmit(){
                computedPostSmDictionaryAdd(this,this.form);
            },
            onCancel(){
                this.$emit('cancel',false);
            },
            refresh(){
                this.$emit("listSearch");
            }
        },
    }
</script>